c# use readonly array as method default

52

c# use readonly array as method default -

private static readonly int[] FooDefault = new int[] { 5, 10 };
public void Foo(int[] x = null)
{
    x = x ?? FooDefault;
}

Comments

Submit
0 Comments